/* Copyright (c) 2004-2008, Andriy Nikolov
 * All rights reserved.
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
package org.processmining.importing.email;

import javax.swing.filechooser.*;
import java.io.*;
import org.processmining.importing.*;
import org.processmining.mining.*;
import org.processmining.framework.ui.filters.*;
import java.awt.*;
import org.processmining.email.*;

/**
 * <p>Import plugin class for loading the e-mail log stored in XML-file.</p>
 * @author not attributable
 * @version 1.0
 */
public class EMailImport implements ImportPlugin {
  boolean packFrame = false;
  EMailLog eMailLog;
  EMailLogReader log;

  public EMailImport() {
  }

  public String getName() {
    return "E-mail log file";
  }

  public javax.swing.filechooser.FileFilter getFileFilter() {
    return new GenericFileFilter("xml");
  }

  public MiningResult importFile(InputStream input) throws IOException {
    eMailLog = new EMailLog();
    log = new EMailLogReader(input);
    log.setEMailLog(eMailLog);
    log.parse();
    EMailMiningResult result = new EMailMiningResult(eMailLog);

    return result;
  }

  public String getHtmlDescription() {
    return "...";
  }
}
